package com.abc.robot01.flutter


import android.os.Bundle
import androidx.annotation.NonNull
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugin.common.MethodChannel
import io.flutter.plugins.GeneratedPluginRegistrant


class XiangQingActivity: FlutterActivity() {
    val CHANNEL: String = "com.abc.robot01.xiangqing"

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
    }

    override fun getInitialRoute(): String {
        // 指定加载的 Flutter 界面
        return "/xiangqing"
    }

    override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
        GeneratedPluginRegistrant.registerWith(flutterEngine)
        MethodChannel(flutterEngine.getDartExecutor().getBinaryMessenger(), CHANNEL)
            .setMethodCallHandler { call, result ->
                if (call.method.contentEquals("getId")) {
                    result.success(intent.getStringExtra("id")+"_"
                            +intent.getStringExtra("accessToken")
                    )
                }
            }
    }



}
